package cate.game.activity.rebate.po;


import cate.common.table.activity.rebate.row.RebateBaseRow;
import cate.common.table.activity.rebate.row.RebateRow;
import cate.game.role.Role;
import cate.game.role.RoleDependent;
import com.fasterxml.jackson.annotation.JsonIgnore;
import easy.java.dev.note.NoteField;

import java.beans.Transient;

public class RebateItem extends RoleDependent {
    public int id;
    @NoteField("所属分组id")
    public int groupId;
    @NoteField("是否可以领取奖励")
    public boolean available;
    @NoteField("是否领取过")
    public boolean got;
    public int day;
    @Override
    public void initialize(Role role) {
        super.initialize(role);
    }

    public RebateItem() {
    }

    public RebateItem(RebateRow row) {
        init(row);
    }

    @JsonIgnore
    @Transient
    public RebateRow getRow(){
        return role.getGame().table.rebate.rebateSheet.get(this.id);
    }

    @JsonIgnore
    @Transient
    public RebateBaseRow getBaseRow() {
        return role.getGame().table.rebate.rebateBase.getRowByGroup(groupId);
    }


    private void init(RebateRow row){
        this.id = row.id;
        this.groupId = row.group;
        this.day = row.serialPayDays;
    }
}
